SPB Git forge
28commits 1branches 0releases
7.7 MBsize
maindefault branch
10 days agolast push
Python 66.3% TypeScript 22.7% JavaScript 8.6% HTML 1.4% CSS 0.7%
1.3 KB · 32 lines tsx
Raw Blame History
1import { api, safe } from '@/lib/api';2import { fmtInt } from '@/lib/format';3import { OG_CONTENT_TYPE, OG_SIZE, renderSiteOg, renderTopicOg } from '@/lib/og';4import { SITE_NAME } from '@/lib/site';56/** Country share image: name, region, monitored companies, activity counters. */7export const alt = `Country on ${SITE_NAME}`;8export const size = OG_SIZE;9export const contentType = OG_CONTENT_TYPE;1011export default async function CountryOpenGraphImage({ params }: { params: Promise<{ code: string }> }) {12  const { code } = await params;13  const d = await safe(api.country(code.toUpperCase()));14  if (!d) return renderSiteOg(await safe(api.stats()));15  const list = Array.isArray(d.companies) ? d.companies : [];16  const count = Array.isArray(d.companies) ? d.companies.length : d.companies;17  const industries = (d.industries ?? []).length;18  return renderTopicOg({19    eyebrow: d.region ? `Country · ${d.region}` : 'Country',20    title: d.name,21    subtitle: `Companies headquartered in ${d.name}, observed continuously on their public web surfaces.`,22    names: list.map((c) => c.display_name),23    counters: [24      ['Companies', fmtInt(count)],25      ['Events 7d', fmtInt(d.events_7d)],26      ['Events 30d', fmtInt(d.events_30d)],27      ['Industries', fmtInt(industries)],28    ],29    path: `/country/${d.code.toLowerCase()}`,30  });31}32